//
//  SearchBar.m
//  微博2期
//
//  Created by J on 15/11/21.
//
//

#import "SearchBar.h"

@implementation SearchBar

- (instancetype)init{
    
    if (self = [super init]) {
        
        
        JZJLog(@"%s",__FUNCTION__);
        
    }
    
    return self;
    
}

- (instancetype)initWithFrame:(CGRect)frame{
    JZJLog(@"%s",__FUNCTION__);

    
    if (self = [super initWithFrame:frame]) {
        

        self.font = [UIFont systemFontOfSize:15];
        self.placeholder = @"请输入...";
        self.background = [UIImage imageNamed:@"searchbar_textfield_background"];
        
        UIImageView * searchIcon =[[UIImageView alloc]init];
        searchIcon.image = [UIImage imageNamed:@"searchbar_textfield_search_icon"];
        searchIcon.width = 30;
        searchIcon.height = 30;
        //    searchIcon.backgroundColor = [UIColor orangeColor];
        searchIcon.contentMode = UIViewContentModeCenter;//设置图片在imageView中居中
        self.leftView = searchIcon;
        self.leftViewMode = UITextFieldViewModeAlways;

        //    分类    UITextField/UISearchBar
        //    自定义控件: 新建一个类, 继承于UITextField
        //    工具类 （最low）

        
    }
    
    return self;
    
}


+ (instancetype)searchBar{
    
    JZJLog(@"%s",__FUNCTION__);

    return [[self alloc]init];
    
}
@end
